import Vue from "vue"
import VueI18n from "vue-i18n"
import Element from 'element-ui'

Vue.use(VueI18n)

import en from './lang/en.js';
import cn from './lang/cn.js';
import enLocale from 'element-ui/lib/locale/lang/en';
import zhLocale from 'element-ui/lib/locale/lang/zh-CN';

const messages = {
    en: {
        ...en,
        ...enLocale
    },
    zh: {
        ...cn,
        ...zhLocale
    }
};

const i18n = new VueI18n({
    locale:  localStorage.getItem('lang') || "zh", // set locale
    messages, // set locale messages
});

Vue.use(Element, {
    i18n: (key, value) => i18n.t(key, value)
});

export default i18n;






